Skip to content

fix(studio): a sealed gesture recording moves the layer live in the preview - #8592

Merged
miguel-heygen merged 2 commits into
mainfrom
fix/sealed-recording-moves-live
Nov 23, 2026
Merged

miguel-heygen merged 2 commits into
mainfrom
fix/sealed-recording-moves-live

Conversation

@miguel-heygen

@miguel-heygen miguel-heygen commented Nov 23, 2026 •

Copy link
Copy Markdown
Collaborator

What

On a sealed preview, recording a gesture now shows the layer moving with the pointer while you record, as it does unsealed. Before, the layer stood still in the preview until the recording was saved.

Why

Unsealed, the recorder moves the layer live by setting its GSAP values through the frame's window on every sample. A sealed frame doesn't expose its window, so the recorder recorded the right values (#8568) but drew nothing while recording.

Related work

Follows #8568, which made a sealed recording read the layer's values and the film's size from the frame.

How

useGestureRecording.ts: on a sealed frame, each sample that moves the layer draws its offset from where the recording started on the layer's stand-in, through drawPreviewDraft, the same draft a sealed drag draws. When the recording stops or Studio unmounts, the draft ends with "restore", so the layer goes back as unsealed's clearProps puts it back until the saved keyframes load. Unsealed is unchanged.

Limits: the draft draws position only, so a sealed recording shows a move live but not a scale, opacity or rotation change. A layer whose position GSAP already animates shows that animation plus the recorded offset while recording; the saved keyframes are unaffected.

Before

Sealed preview, mid-recording after moving the pointer down and right: the layer (yellow) stays where it started.

Before: sealed, mid-recording, the layer stays at its start

After

Same recording: the layer follows the pointer. Its box at this moment, read from the frame, is the same as unsealed's to the pixel (1264, 596 in film px from 600, 330 at the start).

After: sealed, mid-recording, the layer follows the pointer

Test plan

  • Unit tests added/updated
  • Manual testing performed
  • Documentation updated (if applicable)
  • Comments follow CONTRIBUTING.md "Comments"

fails without the fix:

  • packages/studio/src/hooks/useGestureRecording.sealed.test.tsx: "draws the layer moving live on the frame, and puts it back when the recording stops".

"draws nothing over the channel for an unsealed frame, whose GSAP moves the layer" (same file) passes on main too; it pins that unsealed draws nothing.

  • With the fix, useGestureRecording.sealed.test.tsx, useGestureRecording.test.ts and useGestureCommit.test.tsx pass three runs in a row on Linux (30 tests). Studio's src/hooks (178 files, 1,864 tests) passes, and Studio typechecks clean.
  • The captures come from Studio built at this branch and at main on Linux, run headless on the edit bench's move-idle case (GSAP loaded, no tween), sealed and unsealed.

@github-actions

github-actions Bot commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

Edit accuracy: accurate 271 (base branch 271), smooth 48 of those

The gate passes.
Smoothness is reported in the artifact, not gated. A case fails only if it fails 2 of 3 runs.

Quarantined, measured but not gated (0)

@miguel-heygen

Copy link
Copy Markdown
Collaborator Author

#8591 is on main, merged in at 96f0a7f so the edit accuracy gate reruns on it. On the non-blocking jump (a recording started while an earlier sealed drag on the layer is still saving): the follow-up that moves the recording onto the frame's GSAP route sets absolute values instead of a translate over the frame's before-record, which is where that jump comes from. I'll cover it with a row there.

@jrusso1020 jrusso1020 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: APPROVE. Need ✅ · Size ✅ (+13 product lines) · Reuse ✅ (drawPreviewDraft/endPreviewDraft, the same draft a sealed drag draws) · Simpler ✅ · Structure ✅
Risk: low. Only sealed recordings take the new path, and unsealed draws nothing (pinned by the second test).

What I checked at 670a0f6c; 96f0a7fe only merges main (with #8591), and its diff against main has the same changed lines:

  • Fails without the fix. The named test reads drafts.draw.mock.lastCall. Before this change the recorder never draws a draft, so that read fails and the test goes red. With the fix it pins the offset (+200 px) and a single "restore" end.
  • Units. The draft draws x/y − basePosition, which is the same offset from the recording start that gets recorded. A sealed drag passes the same kind of value (offset − initialOffset), so the preview and the saved keyframes agree.
  • Every exit ends the draft. releaseRuntimePreview ends the draft before its !runtime early return, and on a sealed frame that early return always fires. stopRecording and unmount both go through it. A startRecording that fails returns before drawsOn is set, so nothing is left to clean up.
  • Rotate and size. drawPreviewDraft merges each new part into the earlier ones, so drawing only translate keeps any rotate or size already drawn on that stand-in.

Non-blocking: if a recording starts while an earlier sealed drag on the same layer is still saving, the recording's first draw takes over that draft and clears the saving mark. Its "restore" then puts the layer back to its place before the drag until the save's reload lands. The layer can briefly jump during that window, but nothing saved changes. A follow-up could start the recording only after previewDraftLive is false.

— Rames (hf-review)

@miguel-heygen
miguel-heygen added this pull request to the merge queue Nov 23, 2026
Merged via the queue into main with commit c0753d2 Nov 23, 2026
77 checks passed
@miguel-heygen
miguel-heygen deleted the fix/sealed-recording-moves-live branch November 23, 2026 14:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants